package com.example.idachuappone.cook.entity;

import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;

public class Set {
    private List<Area> area;
    private List<City> city;
    private List<Tags> tag;

    public void parseJson(JSONObject json) {
        if (json != null) {
            JSONArray jsonArray;
            int i;
            if (json.has("tag")) {
                try {
                    jsonArray = json.getJSONArray("tag");
                    this.tag = new ArrayList();
                    for (i = 0; i < jsonArray.length(); i++) {
                        this.tag.add(new Tags().parseJson(jsonArray.optJSONObject(i)));
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            if (json.has("city")) {
                jsonArray = json.optJSONArray("city");
                this.city = new ArrayList();
                for (i = 0; i < jsonArray.length(); i++) {
                    this.city.add(new City().parseJson(jsonArray.optJSONObject(i)));
                }
            }
            if (json.has("area")) {
                jsonArray = json.optJSONArray("area");
                this.area = new ArrayList();
                for (i = 0; i < jsonArray.length(); i++) {
                    this.area.add(new Area().parseJson(jsonArray.optJSONObject(i)));
                }
            }
        }
    }

    public List<Tags> getTag() {
        return this.tag;
    }

    public void setTag(List<Tags> tag) {
        this.tag = tag;
    }

    public List<City> getCity() {
        return this.city;
    }

    public void setCity(List<City> city) {
        this.city = city;
    }

    public List<Area> getArea() {
        return this.area;
    }

    public void setArea(List<Area> area) {
        this.area = area;
    }
}
